﻿using System.Diagnostics.Contracts;

namespace System
{
    [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
    public sealed class ElementDescriptionAttribute : Attribute
    {
        public string Description { set; get; }

        public ElementDescriptionAttribute(string Description)
        {
            Contract.Requires(!string.IsNullOrEmpty(Description));
            this.Description = Description;
        }

        public override string ToString()
        {
            Contract.Ensures(Contract.Result<string>() != null);
            return Description;
        }

        [ContractInvariantMethod]
        private void ContractInvariantMethod()
        {
            Contract.Invariant(!string.IsNullOrEmpty(Description));
        }
    }
}